<template>
    <div>
        <input type="text" v-model="user.name">
        <input type="text" v-model="user.age">
    </div>
</template>
  
<script>
export default {
    data() {
        return {
            user: {
                name: "张三",
                age: 18
            }
        }
    },
    watch: {
        user: {
            handler(newVal, oldVal) {
                console.log("newVal", newVal.name, newVal.age);
                console.log("oldVal", oldVal.name, newVal.age);
            },
            deep: true,
            immediate: true
        }

    }
}
</script>
  
<style></style>